const englishMonthList = [
  { title: { CH: "一月", US: "Jan" }, key: 0 },
  { title: { CH: "二月", US: "Feb" }, key: 1 },
  { title: { CH: "三月", US: "Mar" }, key: 2 },
  { title: { CH: "四月", US: "Apr" }, key: 3 },
  { title: { CH: "五月", US: "May" }, key: 4 },
  { title: { CH: "六月", US: "Jun" }, key: 5 },
  { title: { CH: "七月", US: "Jul" }, key: 6 },
  { title: { CH: "八月", US: "Aug" }, key: 7 },
  { title: { CH: "九月", US: "Sept" }, key: 8 },
  { title: { CH: "十月", US: "Oct" }, key: 9 },
  { title: { CH: "十一月", US: "Nov" }, key: 10 },
  { title: { CH: "十二月", US: "Dec" }, key: 11 },
];

const getNewDate = (date) => {
  let year = date.getFullYear();
  let month = date.getMonth();
  let day = date.getDate();
  return { year, month, day };
}

const getDate = (year, month, day) => {
  return new Date(year, month, day);
}

const englishMonth = (month, language) => {
  let engMonth;

  englishMonthList.map(() => {
    engMonth = englishMonthList[month].title[language]
  });

  return engMonth
}

const formatDate = (date) => {
  date = Number(date);
  return date < 10 ? `0${date}` : date;
}
export {
  getNewDate,
  getDate,
  englishMonth,
  formatDate
}